package org.filecollector.filecontroller.virtualcatalogue.virtualfile;

import java.nio.file.Path;

/**
 * Interface which describe {@link java.io.File File} implementation in this program. Simplifies
 * reading and writing process, provides single response object for every action to separately taken ID,
 * encapsulates most of stuffy job with {@link java.io.File Java Files}.
 * <p>
 *     Methods should throws only {@link InvalidFileException InvalidFileException} during
 *     the normal operation
 * </p>
 * <p>
 *     Some of methods can throw {@link SecurityException} if encapsulated File became protected for writing or reading
 *     during runtime. Nope, it is <b>not</b> the normal operation when anything has access into the program's files
 *     besides the program itself.
 * </p>
 * @implNote JavaDoc is linked to {@link VirtualFileClass} because it is the main implementation
 */
public interface VirtualFile {
    /**
     * @see VirtualFileClass#isExists()
     */
    boolean isExists();
    /**
     * @see VirtualFileClass#getId()
     */
    Long getId();
    /**
     * @see VirtualFileClass#size()
     */
    Long size();
    /**
     * @see VirtualFileClass#getDependencies()
     */
    VirtualFileDependencies getDependencies();
    /**
     * @see VirtualFileClass#getDao()
     */
    VirtualFileDao getDao();
    /**
     * @see VirtualFileClass#getPath()
     */
    Path getPath();
    /**
     * @see VirtualFileClass#calculateCheckSum()
    */
    Long calculateCheckSum();
    /**
     * @see VirtualFileClass#writeDirectly(char[], boolean)
     */
    boolean writeDirectly(char[] buffer, boolean append);
    /**
     * @see VirtualFileClass#readDirectly(int)
     */
    char[] readDirectly(int size);
    /**
     * @see VirtualFileClass#remove()
     */
    boolean remove();
}
